//
//  FQDDatabase.h
//  FakeQDaily
//
//  Created by mewxiv on 8/18/16.
//  Copyright © 2016 Xensius. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface FQDDatabase : NSObject

+ (instancetype)sharedDatabase;

- (void)createTableIfNotExist:(NSString *)tableName columns:(NSDictionary<NSString *, NSString *> *)columns;
- (void)insertIntoTable:(NSString *)tableName columnValues:(NSDictionary<NSString *, id> *)columnValues;
- (void)insertOrReplaceIntoTable:(NSString *)tableName columnValues:(NSDictionary<NSString *, id> *)columnValues;
- (void)deleteFromTable:(NSString *)tableName whereCondition:(NSString *)condition;
- (void)deleteAllFromTable:(NSString *)tableName;
- (BOOL)updateTable:(NSString *)tableName setColumnValues:(NSDictionary<NSString *, id> *)columnValues whereCondition:(NSString *)condition;
- (id)selectColumn:(NSString *)columnName fromTable:(NSString *)tableName whereCondition:(NSString *)condition;
- (NSArray *)selectColumns:(NSArray<NSString *> *)columnNames fromTable:(NSString *)tableName whereCondition:(NSString *)condition;
- (NSArray *)selectAllColumnsFromTable:(NSString *)tableName whereCondition:(NSString *)condition;
- (void)executeSQL:(NSString *)sql;
- (BOOL)tableExists:(NSString *)tableName;

- (void)closeDatabase;

@end
